#include<iostream>
using namespace std;
const int N = 55, MOD = 1e9 + 7;
int f[N][N][13][14];
int w[N][N];
int n, m, k;
int main()
{
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> w[i][j];
			w[i][j]++;
		}
	}
	f[1][1][1][w[1][1]] = 1;
	f[1][1][0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (i == 1 && j == 1) continue;
			for (int u = 0; u <= k; u++) {
				for (int z = 0; z <= 13; z++) {
					int& val = f[i][j][u][z];
					val = (val + f[i - 1][j][u][z]) % MOD;
					val = (val + f[i][j - 1][u][z]) % MOD;
					if (z == w[i][j] && u > 0) {
						for (int m = 0; m < z; m++) {
							val = (val + f[i - 1][j][u - 1][m]) % MOD;
							val = (val + f[i][j - 1][u - 1][m]) % MOD;
						}
					}
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= 13; i++) {
		ans = (ans + f[n][m][k][i]) % MOD;
	}
	cout << ans << endl;
	return 0;
}